		scope.getInInfo = function(onsuccess){
			shutAllPages(scope);
			http.post("GetAllAcceptInfo.action").success(function(response) {
				scope.tempInInfoList = response;
				scope.InInfoManagementPage = 1;
				scope.inInfoList = [];
				for( var i = 0; i < 10 && i < scope.tempInInfoList.length ; i++ ){
					scope.inInfoList[i] = scope.tempInInfoList[i];
				}
				onsuccess();
			});
			$("input[name='slectAll']").prop("checked",false);
			$("input[name='inInfobox']").prop("checked",false);			
			scope.inboxShow=true;
		};
		
		scope.pageInInfoManagement = function(page){
			$("input[name='slectAll']").prop("checked",false);
			$("input[name='inInfobox']").prop("checked",false);
			var maxCount = 10;
			var min = ( page - 1 ) * maxCount;
			if( min < 0 || min >= scope.tempInInfoList.length )
				return ;
			scope.inInfoList = [];
			for( var i = 0; i < maxCount && ( min + i + 1 ) <= scope.tempInInfoList.length;i++ ){
				scope.inInfoList[i] = scope.tempInInfoList[min + i];
			}
			scope.InInfoManagementPage = page;
		}
		
		scope.getSendInfo = function(onsuccess){
			shutAllPages(scope);
			http.post("GetAllSendInfo.action").success(function(response) {
				scope.tempPostInfoList = response;
				scope.PostInfoManagementPage = 1;
				scope.postInfoList = [];
				for( var i = 0; i < 10 && i < scope.tempPostInfoList.length ; i++ ){
					scope.postInfoList[i] = scope.tempPostInfoList[i];
				}
				onsuccess();
			});
			$("input[name='slectAll']").prop("checked",false);
			$("input[name='postInfobox']").prop("checked",false);			
			scope.postboxShow=true;
		};
		
		scope.pagePostInfoManagement = function(page){
			$("input[name='slectAll']").prop("checked",false);
			$("input[name='postInfobox']").prop("checked",false);
			var maxCount = 10;
			var min = ( page - 1 ) * maxCount;
			if( min < 0 || min >= scope.tempPostInfoList.length )
				return ;
			scope.postInfoList = [];
			for( var i = 0; i < maxCount && ( min + i + 1 ) <= scope.tempPostInfoList.length;i++ ){
				scope.postInfoList[i] = scope.tempPostInfoList[min + i];
			}
			scope.PostInfoManagementPage = page;
		};
		
		http.post("GetNotReadInfoNumber.action").success(function(response) {
			scope.infoNotReadNumber = response;				
		});
		
		scope.info  = {};
		scope.sendInfo = function(){			
			http.post("SendInfo.action", {"infoAcceptUserId" : scope.info.infoAcceptUserId, "infoName" : scope.info.infoName, "infoBody" : scope.info.infoBody }).success(function(response) {
				alert("发送成功");
				onsuccess = function(){
					var i = parseInt(scope.tempPostInfoList.length / 10);
					if(  scope.tempPostInfoList.length % 10 == 0 ){
						scope.pagePostInfoManagement(i);
					}
					else{
						scope.pagePostInfoManagement(i+1);
					}
				}
				scope.getSendInfo(onsuccess);
			});
			
		};
		
		scope.getMailInInfo = function(info){
			scope.inInfo = info;
			shutAllPages(scope);
			scope.mainInInfoShow=true;
			var inInfoIdList =new Array();
			inInfoIdList.push(info.infoId);
			http.post("ReadInfo.action", { "inInfoIdList": inInfoIdList }).success(function(response) {
				http.post("GetNotReadInfoNumber.action").success(function(response) {
					scope.infoNotReadNumber = response;				
				});				
			});
		};
		
		scope.getMailPostInfo = function(info){
			scope.postInfo = info;
			shutAllPages(scope);
			scope.mainPostInfoShow=true;			
		};
		
		
		scope.setRead = function(){
			var inInfoIdList = new Array();
			$("input[name='inInfobox']:checked").each(function() {
				inInfoIdList.push(this.value);
			});
			if (inInfoIdList.length <= 0) {
				return;
			}
			
			http.post("ReadInfo.action", { "inInfoIdList": inInfoIdList }).success(function(response) {
				if (response.indexOf("success") > -1) {
					onsuccess = function(){
						var i = parseInt((scope.tempInInfoList.length - 1) / 10);
						console.log(i);
						if(  scope.tempInInfoList.length % 10 == 0 ){
							scope.pageInInfoManagement(i - 1);
						}
						else{
							scope.pageInInfoManagement(i);
						}
					}
					scope.getInInfo(onsuccess);
					http.post("GetNotReadInfoNumber.action").success(function(response) {
						scope.infoNotReadNumber = response;				
					});
					return;
				} else {
					alert(response);
				}
			}).error(function(response){
				alert(response);
			});
		};
		
		scope.deleteInInfo = function(inInfoId){
			var inInfoIdList = new Array();
			if (inInfoId != null) {
				inInfoIdList.push(inInfoId);
			} else {
				$("input[name='inInfobox']:checked").each(function() {
					inInfoIdList.push(this.value);
				});
			}
			if (inInfoIdList.length <= 0) {
				alert("请至少选择一个需要删除的项！");
				return;
			}
			http.post("DeleteInInfo.action", { "inInfoIdList" : inInfoIdList }).success(function(response) {
				if (response.indexOf("success") > -1) {
					alert("操作成功！");
					onsuccess = function(){
						var i = parseInt((scope.tempInInfoList.length - 1) / 10);
						console.log(i);
						if(  scope.tempInInfoList.length % 10 == 0 ){
							scope.pageInInfoManagement(i - 1);
						}
						else{
							scope.pageInInfoManagement(i);
						}
					}
					scope.getInInfo(onsuccess);
					http.post("GetNotReadInfoNumber.action").success(function(response) {
						scope.infoNotReadNumber = response;				
					});
					return;
				} else {
					alert(response);
				}
			}).error(function(response){
				alert(response);
			});
		};

		scope.wasteInInfo = function(inInfoId){
			var inInfoIdList = new Array();
			if (inInfoId != null) {
				inInfoIdList.push(inInfoId);
			} else {
				$("input[name='inInfobox']:checked").each(function() {
					inInfoIdList.push(this.value);
				});
			}
			if (inInfoIdList.length <= 0) {
				alert("请至少选择一个需要废弃的项！");
				return;
			}
			http.post("WasteInInfo.action", { "inInfoIdList" : inInfoIdList }).success(function(response) {
				if (response.indexOf("success") > -1) {
					alert("操作成功！");
					onsuccess = function(){
						var i = parseInt((scope.tempInInfoList.length - 1) / 10);
						console.log(i);
						if(  scope.tempInInfoList.length % 10 == 0 ){
							scope.pageInInfoManagement(i - 1);
						}
						else{
							scope.pageInInfoManagement(i);
						}
					}
					scope.getInInfo(onsuccess);
					http.post("GetNotReadInfoNumber.action").success(function(response) {
						scope.infoNotReadNumber = response;				
					});
					return;
				} else {
					alert(response);
				}
			}).error(function(response){
				alert(response);
			});
		};		

		scope.deletePostInfo = function(postInfoId){
			var postInfoIdList = new Array();
			if (postInfoId != null) {
				postInfoIdList.push(postInfoId);
			} else {
				$("input[name='postInfobox']:checked").each(function() {
					postInfoIdList.push(this.value);
				});
			}
			if (postInfoIdList.length <= 0) {
				alert("请至少选择一个需要删除的项！");
				return;
			}
			http.post("DeletePostInfo.action", { "postInfoIdList" : postInfoIdList }).success(function(response) {
				if (response.indexOf("success") > -1) {
					alert("操作成功！");
					onsuccess = function(){
						var i = parseInt((scope.tempPostInfoList.length - 1) / 10);
						console.log(i);
						if(  scope.tempPostInfoList.length % 10 == 0 ){
							scope.pagePostInfoManagement(i - 1);
						}
						else{
							scope.pagePostInfoManagement(i);
						}
					}
					scope.getSendInfo(onsuccess);
					return;
				} else {
					alert(response);
				}
			}).error(function(response){
				alert(response);
			});
		};
		
		
		scope.repeat = function(info){
			var infoIdList = new Array();
			if (info != null) {
				infoIdList.push(info);
			} else {
				$("input[name='inInfobox']:checked").each(function() {
					infoIdList.push(this.value);
				});
			}
			if (infoIdList.length <= 0) {
				alert("请至少选择一个需要转发的项！");
				return;
			}
			var acceptUserIdList = new Array();
			var user=prompt("要转发的用户Id");
			if( user == null || user == "" ){
				return;
			}
			
			acceptUserIdList.push(user + "");
			console.log(acceptUserIdList);
			console.log(info);
			http.post("RepeatInfo.action", { "infoIdList" : infoIdList, "acceptUserIdList": acceptUserIdList }).success(function(response) {
				if (response.indexOf("success") > -1) {
					alert("操作成功！");
					onsuccess = function(){
						var i = parseInt((scope.tempPostInfoList.length - 1) / 10);
						console.log(i);
						if(  scope.tempPostInfoList.length % 10 == 0 ){
							scope.pagePostInfoManagement(i - 1);
						}
						else{
							scope.pagePostInfoManagement(i);
						}
					}
					scope.getSendInfo(onsuccess);
					return;
				} else {
					alert(response);
				}
			}).error(function(response){
				alert(response);
			});
		};
		